# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.MyBusinessNotifications.V1.Model.NotificationSetting do
  @moduledoc """
  A Google Pub/Sub topic where notifications can be published when a location is updated or has a new review. There will be only one notification setting resource per-account.

  ## Attributes

  *   `name` (*type:* `String.t`, *default:* `nil`) - Required. The resource name this setting is for. This is of the form `accounts/{account_id}/notificationSetting`.
  *   `notificationTypes` (*type:* `list(String.t)`, *default:* `nil`) - The types of notifications that will be sent to the Pub/Sub topic. To stop receiving notifications entirely, use NotificationSettings.UpdateNotificationSetting with an empty notification_types or set the pubsub_topic to an empty string.
  *   `pubsubTopic` (*type:* `String.t`, *default:* `nil`) - Optional. The Google Pub/Sub topic that will receive notifications when locations managed by this account are updated. If unset, no notifications will be posted. The account mybusiness-api-pubsub@system.gserviceaccount.com must have at least Publish permissions on the Pub/Sub topic.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :name => String.t() | nil,
          :notificationTypes => list(String.t()) | nil,
          :pubsubTopic => String.t() | nil
        }

  field(:name)
  field(:notificationTypes, type: :list)
  field(:pubsubTopic)
end

defimpl Poison.Decoder, for: GoogleApi.MyBusinessNotifications.V1.Model.NotificationSetting do
  def decode(value, options) do
    GoogleApi.MyBusinessNotifications.V1.Model.NotificationSetting.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.MyBusinessNotifications.V1.Model.NotificationSetting do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
